% Natasha Savage
% draws a box arounf the peak & finds its centre
% C = concentration matrix
% T = threshold above which we have a peak


function [x,y] = plotter_centre_of_box(C,T)


%% Drawing the box

% find points above threshold T
[I,J] = find(C > T);
% [I,J]
% length(I)

% find min and max row
Imin = min(I);
Imax = max(I);
% find min and max column
Jmin = min(J);
Jmax = max(J);

%% finding the centre, does not have to be a grid point

x = Imin + ceil((Imax - Imin)/2);
y = Jmin + ceil((Jmax - Jmin)/2);

end
